package top.lenjon.lib.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import top.lenjon.lib.entity.Book;
import top.lenjon.lib.entity.Log;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author wei
 * @since 2020/11/18 0:55
 */
@Data
public class LogModel implements Serializable {
    /**
     * 主键id
     */
    private Integer id;

    /**
     * 借阅人id
     */
    private Integer borrowerId;

    /**
     * 借阅时间
     */
    private LocalDateTime borrowTime;

    /**
     * 还书时间
     */
    private LocalDateTime returnTime;

    /**
     * 续借次数
     */
    private Integer renewTimes;

    /**
     * 所借书籍id
     */
    private Integer bookId;

    private String bookName;

    public LogModel(Log log, Book book) {
        this.id = log.getId();
        this.borrowerId = log.getBorrowerId();
        this.renewTimes = log.getRenewTimes();
        this.returnTime = log.getReturnTime();
        this.borrowTime = log.getBorrowTime();
        this.bookId = log.getBookId();
        this.bookName = book.getTitle();
    }
}
